<template>
	<div class="app">
		<div class="isMask">
			<div class="isMask_mask" @click="cancleClick"></div>
			<div class="isMask_content" @click="">
				<div class="isMask_header">
					<text class="isMask_header_title">优惠促销</text>
<!--					<text  class="iconfont icon-close isMask_header_Icon"></text>-->
                    <text @click="cancleClick" class="isMask_header_Icon">&#xe61a;</text>
				</div>
				<div class="isMask_content_box">
					<text class="isMask_content_header">可领优惠券</text>
					<list>
						<cell>
							<div class="coupon-couponList" v-for="(item,index) in product.coupons" :key="item.id">
								<div class="coupon-couponList-port1">
									<div class="coupon-couponList-port1-inner">
										<text class="coupon-couponList-port1-text1">¥</text>
										<text class="coupon-couponList-port1-text2">{{item.amount}}</text>
									</div>
								</div>
								<div class="coupon-couponList-port2">
									<div>
										<text class="coupon-couponList-port2-text1">{{item.name}}</text></div>
									<div>
										<text class="coupon-couponList-port2-text2">适用范围：{{item.targetName}}-{{item.scopeName}}</text>
									</div>
									<div>
										<text class="coupon-couponList-port2-text3">有限期至{{item.endDate}}</text>
									</div>
								</div>
								<div class="coupon-couponList-port3" @click="maskClick(item.id)"><text class="maskText">领取</text></div>
							</div>
						</cell>

					</list>

				</div>
				<div style="widht:100%;height:120px"></div>
				<div class="isMask_botton" @click="cancleClick">
					<text class="isMask_botton_title">确定</text>
				</div>
			</div>
		</div>
	</div>
</template>
<script>
	const eeui = app.requireModule('eeui');
	import {
		create
	} from '../../../../api/coupon'
	export default {

		name: '',
		data() {
			return {

			}
		},
		props: ['product'],
		created() { // 在实例创建完成后被立即调用
			console.log(this.product)
            this.initIconFont()
		},
		methods: {
			cancleClick(){
				this.$emit('cancleClick')
			},
			maskClick(id) {
				if (this.getGlobalData().token == null) {
					eeui.openPage({
						url: 'root://pages/login/index.js',
					})
				} else {
					create({
						couponId: id,
						mchId: this.getGlobalData().mchId
					}).then(res => {
						eeui.alert('领取成功', function() {

						});
					})
				}
			},
		},
		components: {},
	}
</script>

<style scoped>
	.app {
		flex: 1;
	}

	.isMask {

		position: fixed;
		width: 750px;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		/* background-color: rgba(0, 0, 0, 0.3); */
	}

	.isMask_mask {
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background-color: rgba(0, 0, 0, 0.3);
	}

	.isMask_content {
		width: 750px;
		min-height: 600px;
		max-height: 1000px;
		background-color: white;
		position: fixed;
		bottom: 0;
		border-top-right-radius: 16px;
		border-top-left-radius: 16px;
	}

	.isMask_header {
		padding: 20px;
		box-sizing: border-box;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		border-color: rgba(0, 0, 0, 0.3);
		border-bottom-width: 1px;
		border-style: solid;
	}

	.isMask_header_title {
		font-size: 26px;
	}

	.isMask_header_Icon {
		font-size: 32px;
		/*padding-left: 50px;*/
        font-family: iconfont2;
	}

	.isMask_content_box {
		padding: 20px;
		box-sizing: border-box;
		overflow: auto;
		max-height: 800px;
	}

	.isMask_content_header {
		font-size: 24px;
        display: block;
        margin-top: 10px;
	}

	/* .isMask_content_card {
	  width: 100%;
	  height: 130px;
	  border-radius: 10px;
	  background: rgba(252, 147, 147, 0.2);
	  margin-top: 10px;
	  margin-bottom: 10px;
	  display: flex;
	  flex-direction: row;
	  align-items: center;
	  overflow: hidden;
	  position: relative;
	} */

	/* .isMask_content_card_top {
	  width: 16px;
	  height: 14px;
	  border-radius: 50%;
	  position: absolute;
	  top: -8px;
	  left: 192px;
	  background-color: white;
	} */

	/* .isMask_content_card_bottom {
	  width: 16px;
	  height: 14px;
	  border-radius: 50%;
	  position: absolute;
	  bottom: -8px;
	  left: 192px;
	  background-color: white;
	} */

	/* .isMask_content_card_left {
	  display: flex;
	  flex-direction: column;
	  justify-content: center;
	  align-items: center;
	  width: 200px;
	  background-color: rgba(250, 128, 128, 0.3);
	  height: 100%;
	  border-right: 1px dashed rgba(250, 128, 128, 0.2);
	} */

	/* .isMask_content_price_Icon {
	  font-size: 24px;
	  color: rgba(236, 95, 88, 1);
	} */

	/* .isMask_content_price_title {
	  font-size: 36px;
	  color: rgba(236, 95, 88, 1);
	} */
	/*
	.isMask_content_instructions {
	  font-size: 20px;
	  color: rgba(236, 95, 88, 1);
	} */

	/* .isMask_content_card_right {
	  padding: 20px;
	  display: flex;
	  flex-direction: row;
	  justify-content: space-between;
	  align-items: center;
	  width: 470px;
	} */

	/* .isMask_card_right_title {
	  font-size: 24px;
	  color: rgba(0, 0, 0, 0.6);
	  display: block;
	} */

	/* .isMask_card_right_subtitle {
	  font-size: 20px;
	  color: rgba(0, 0, 0, 0.6);
	  display: block;
	} */

	/* .isMask_card_botton {
	  width: 100px;
	  height: 40px;
	  background-color: rgba(236, 95, 88, 1);
	  border-radius: 30px;
	  display: flex;
	  justify-content: center;
	  align-items: center;
	} */

	/* .isMask_card_botton_title {
	  font-size: 20px;
	  color: white;
	} */

	.isMask_botton {
		position: fixed;
		bottom: 30px;
		left: 20px;
		width: 710px;
		height: 70px;
		border-radius: 40px;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		background-color: rgba(236, 95, 88, 1);
	}

	.isMask_botton_title {
		font-size: 28px;
		color: white;
	}

	.coupon-couponList {
		display: flex;
		align-items: center;
		flex-direction: row;
		padding: 30px;
		height: 190px;
		background-color: #fef7ef;
		border-radius: 16px;
		color: #ff1010;
		margin-top: 30px;
        position: relative;
	}

	.coupon-couponList-port1 {
		margin-right: 20px;
		/* flex-grow:2; */
		width: 130px;
		height: 130px;
	}

	.coupon-couponList-port1-inner {
		width: 130px;
		height: 130px;
		justify-content: center;
		display: flex;
		flex-direction: row;
		align-items: center;
	}

	.coupon-couponList-port1-text2 {
		font-size: 60px;
		color: #ff1010;
		font-weight: bolder;
		margin-right: 10px;
	}

	.coupon-couponList-port1-text1 {
		font-size: 24px;
		color: #ff1010;
		padding-top: 20px;
	}

	.coupon-couponList-port2 {
		/* flex-grow:1; */
		margin-right: 20px;
	}

	.coupon-couponList-port2-text1 {
		color: #ff1010;
		font-size: 30px;
		font-weight: bolder;
		margin-bottom: 10px;
	}

	.coupon-couponList-port2-text2 {
		font-size: 24px;
		color: #f48583;

		margin-bottom: 5px;
	}

	.coupon-couponList-port2-text3 {
		font-size: 24px;
		color: #f48583;
	}

	.coupon-couponList-port3 {
		height: 40px;
		width: 130px;
		line-height: 40px;
		flex-grow: 1;
		border-style: solid;
		border-width: 1px;
		margin-left: 20px;
		border-color: #f48583;
		border-radius: 30px;
		padding: 5px;
        position: absolute;
        right: 40px;
	}

	.maskText {
		color: #f48583;
		margin-top: 3px;
		font-size: 24px;
		text-align: center;
	}
</style>
